﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="GameDetails.ascx.cs" Inherits="usercontrols_GameDetails" %>
<%@ Register Src="~/controls/usercontrols/Error.ascx" TagPrefix="uc" TagName="Error" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<table class="contentTable">
    <tr>
        <td align="center" colspan="3">
            <uc:Error ID="ucErrors" runat="server" />
        </td>
    </tr>
    <asp:Panel ID="pnlContents" runat="server">
        <tr>
            <td align="center" colspan="4" style="padding: 10px 0 10px 0">
                <asp:LinkButton ID="lbViewGameDetails" runat="server" Text="Game details" OnClick="SeeViewGameDetails"
                    Enabled="false" ToolTip="Bekijk game details" />&nbsp;|
                <asp:LinkButton ID="lbViewFavorites" runat="server" Text="Populaire games" OnClick="SeeViewFavorites"
                    ToolTip="Bekijk andere populaire games" />&nbsp;|
                <asp:LinkButton ID="lbViewReviews" runat="server" Text="Reviews" OnClick="SeeViewReviews"
                    ToolTip="Bekijk reviews van deze game" />
            </td>
        </tr>
        <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
            <asp:View ID="vGameDetails" runat="server">
                <tr>
                    <td colspan="3">
                        <b>
                            <asp:Label ID="lblGameTitle" runat="server" Font-Size="14px" /></b>
                    </td>
                </tr>
                <tr>
                    <td rowspan="2" style="padding: 10px 0px 10px 0px; width: 18%">
                        <asp:Image ID="iGamePicture" runat="server" ToolTip="Afbeelding van hoesje" />
                    </td>
                    <td style="padding-top: 10px; font-size: 14px; width: 20%" valign="top">
                        <b>Uitgever:</b><br />
                        <b>Platform:</b><br />
                        <b>Prijs:</b><br />
                        <b>Kosten hoesje:</b><br />
                        <b>Voorraad:</b>
                    </td>
                    <td style="padding-top: 10px; font-size: 14px" valign="top">
                        <asp:LinkButton ID="lbGamePublisher" runat="server" ToolTip="Bekijk uitgever details" /><br />
                        <asp:Label ID="lblGamePlatform" runat="server" /><br />
                        <asp:Label ID="lblGamePrice" runat="server" /><br />
                        <asp:Label ID="lblGameCoverPrice" runat="server" Text="€ 0,50" />&nbsp;<asp:LinkButton
                            ID="lbOrderCover" runat="server" Text="Bestel hoesje" Visible="false" /><br />
                        <asp:Label ID="lblGameStock" runat="server" />&nbsp;<asp:ImageButton ID="ibtnRefreshGameStock"
                            runat="server" ImageUrl="~/img/refresh.png" ToolTip="Vernieuw voorraad" OnClick="RefreshGameStock" />
                        <AjaxControlToolkit:ModalPopupExtender ID="mPopupPublisher" runat="server" TargetControlID="lbGamePublisher"
                            PopupControlID="pnlPublisher" BackgroundCssClass="popupBackground" OkControlID="lbClosePublisherForm">
                        </AjaxControlToolkit:ModalPopupExtender>
                        <asp:Panel ID="pnlPublisher" runat="server" CssClass="publisherContent">
                            <div id="publisherBar">
                                <table width="100%" border="0">
                                    <tr>
                                        <td align="left" style="width: 50%">
                                            Uitgever informatie
                                        </td>
                                        <td align="right" style="width: 50%">
                                            <asp:LinkButton ID="lbClosePublisherForm" runat="server" Text="X" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <table width="100%" style="padding: 10px">
                                <tr>
                                    <td>
                                        <asp:Image ID="ibtnPublisher" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 5%">
                                        <b>Naam:</b>&nbsp;<asp:Label ID="lblPublisherName" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="padding-top: 10px">
                                        Hieronder ziet u een overzicht met alle games van deze uitgever.
                                    </td>
                                </tr>
                                <tr>
                                    <td style="padding-top: 10px">
                                        <asp:GridView ID="gvPublisherGames" AutoGenerateColumns="false" runat="server" GridLines="Horizontal"
                                            BorderStyle="Outset" CellPadding="1" CssClass="grid" OnRowDataBound="gvPublisherGames_RowDataBound">
                                            <RowStyle CssClass="gridroweven" />
                                            <AlternatingRowStyle CssClass="gridrowodd" />
                                            <EmptyDataTemplate>
                                                Er zijn geen games van deze uitgever aanwezig in de database.
                                            </EmptyDataTemplate>
                                            <Columns>
                                                <asp:TemplateField HeaderText="Artikelnaam" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left"
                                                    HeaderStyle-Width="40%">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="lbGameTitle" runat="server" CommandArgument='<%# Eval("GameNr") + "_" + Eval("Platform") %>'
                                                            Text='<%# Eval("Title") %>' ToolTip='<%# Eval("DescriptionShort") %>' OnClick="GetGameDetails" />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Platform" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left"
                                                    HeaderStyle-Width="25%">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblGamePlatform" runat="server" Text='<%# Eval("Platform") %>' />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Voorraad" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left"
                                                    HeaderStyle-Width="12%">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblGameStock" runat="server" Text='<%# Eval("Stock") %>' />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Prijs" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Left"
                                                    HeaderStyle-Width="13%">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblGamePrice" runat="server" Text='<%# Eval("Price") %>' />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="10%">
                                                    <ItemTemplate>
                                                        <asp:Button ID="btnOrderGame" runat="server" Text="Bestel" CssClass="buttonRed" ToolTip="Voeg artikel toe aan winkelwagen"
                                                            OnClick="AddToCart" CommandArgument='<%# Eval("GameNr") + "_" + Eval("Platform") %>' />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td style="padding-bottom: 9px">
                        <asp:Button ID="btnAddToCart" runat="server" CssClass="buttonRed" Text="Bestel" OnClick="AddToCart"
                            ToolTip="Voeg artikel toe aan winkelwagen" />
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <asp:Label ID="lblGameDescriptionLong" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:LinkButton ID="lbBackToSearchResults" runat="server" Text="Terug naar resultaten"
                            OnClick="BackToSearchResults" />
                    </td>
                </tr>
            </asp:View>
            <asp:View ID="vFavorites" runat="server">
                <tr>
                    <td colspan="4" style="padding-bottom: 10px">
                        Hieronder ziet u een overzicht van games die kopers van
                        <asp:Label ID="lblTitle" Font-Bold="true" runat="server" />
                        voor de
                        <asp:Label ID="lblPlatform" runat="server" Font-Bold="true" />
                        ook gekocht hebben.
                    </td>
                </tr>
                <tr>
                    <asp:Panel ID="pnlFavorites" runat="server" />
                </tr>
            </asp:View>
            <asp:View ID="vReviews" runat="server">
                <tr>
                    <td>
                        <asp:Panel ID="pnlLoggedIn" runat="server" Visible="false">
                            <table width="100%">
                                <tr>
                                    <td>
                                        Hieronder ziet u de vijf meest recente reviews van deze game. Als u zelf een review
                                        wil schrijven over deze game, klik dan&nbsp;<asp:LinkButton ID="lbReview" runat="server"
                                            Text="hier" />.
                                        <AjaxControlToolkit:ModalPopupExtender ID="mPopupReview" runat="server" TargetControlID="lbReview"
                                            PopupControlID="pnlReview" BackgroundCssClass="popupBackground" OkControlID="lbCloseForm">
                                        </AjaxControlToolkit:ModalPopupExtender>
                                    </td>
                                </tr>
                            </table>
                            <asp:Panel ID="pnlReview" runat="server" CssClass="reviewContent">
                                <div id="reviewBar">
                                    <table width="100%" border="0">
                                        <tr>
                                            <td align="left" style="width: 50%">
                                                Schrijf een review
                                            </td>
                                            <td align="right" style="width: 50%">
                                                <asp:LinkButton ID="lbCloseForm" runat="server" Text="X" />
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <table width="100%" style="padding: 10px;">
                                    <tr>
                                        <td colspan="2">
                                            Hieronder kunt u een review schrijven over de game
                                            <asp:Label ID="lblReviewGameTitle" Font-Bold="true" runat="server" />. Dit is een
                                            actie die u eenmalig kunt uitvoeren. U kunt de review later nog wel aanpassen mocht
                                            u dat noodzakelijk vinden. Dit kunt u dan doen door naar "Mijn account" te gaan
                                            en daar op "Mijn reviews" te klikken.
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 10%; padding-top: 10px" valign="top">
                                            <b>Tekst:</b>
                                        </td>
                                        <td style="padding-top: 10px">
                                            <asp:TextBox ID="txtWriteReview" CssClass="textboxMultiLine" runat="server" TextMode="MultiLine"
                                                Width="99%" Height="200px" ValidationGroup="Review" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <b>Resterend:</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtReviewCount" runat="server" Width="40px" Enabled="false" ValidationGroup="Review"
                                                Text="1024" Style="border: solid 1px #a3a3a3" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <b>Cijfer:</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtReviewPoints" runat="server" CssClass="textboxNormal" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-top: 10px">
                                            <asp:Button ID="btnAddReview" runat="server" Text="Toevoegen" CssClass="buttonRedLarge"
                                                OnClick="AddGameReview" ValidationGroup="Review" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:RequiredFieldValidator ID="rfvWriteReview" runat="server" ControlToValidate="txtWriteReview"
                                                ErrorMessage="U dient tekst in te voeren om de review te kunnen toevoegen." SetFocusOnError="true"
                                                ValidationGroup="Review" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:RequiredFieldValidator ID="rfvPoints" runat="server" ControlToValidate="txtReviewPoints"
                                                ErrorMessage="U dient een cijfer in te voeren om de review te kunnen toevoegen."
                                                SetFocusOnError="true" ValidationGroup="Review" />
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </asp:Panel>
                        <asp:Panel ID="pnlLoggedInPositiveReview" runat="server" Visible="false">
                            <table width="100%">
                                <tr>
                                    <td>
                                        Hieronder ziet u de vijf meest recente reviews van deze game. U kunt echter geen
                                        review meer schrijven omdat u al een review heeft geschreven. Deze kunt u <a href="about:blank">
                                            hier</a> bekijken en/of eventueel wijzigen.
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                        <asp:Panel ID="pnlNotLoggedIn" runat="server" Visible="false">
                            <table width="100%">
                                <tr>
                                    <td>
                                        Hieronder ziet u de vijf meest recente reviews van deze game. Om zelf een review
                                        te kunnen schrijven dient u ingelogd te zijn.
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td>
                                    Aantal reviews: <b><asp:Label ID="lblAmountOfReviews" runat="server" /></b><br />
                                    Het gemiddelde cijfer dat gebruikers deze game gaven: <b>
                                        <asp:Label ID="lblAveragePoints" runat="server" /></b>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top: 10px; padding-bottom: 10px">
                        <asp:Repeater ID="rpReviews" runat="server" OnItemDataBound="rpReviews_ItemDataBound">
                            <SeparatorTemplate>
                                <br />
                            </SeparatorTemplate>
                            <ItemTemplate>
                                <table width="100%" style="background-color: #f1f1f1">
                                    <tr style="font-size: 14px">
                                        <td style="width: 40%">
                                            <b>Door:</b>&nbsp;<asp:Label ID="lblReviewUser" runat="server" /><asp:HiddenField
                                                ID="hfUserId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "UserId") %>' />
                                        </td>
                                        <td>
                                            <b>Cijfer:</b>&nbsp;<asp:Label ID="lblReviewCipher" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Cipher") %>' />
                                        </td>
                                        <td align="right">
                                            <b>Datum:</b>&nbsp;<asp:Label ID="lblReviewDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Date") %>' />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3" style="padding-top: 10px">
                                            <asp:Label ID="lblReviewText" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Text") %>' />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <asp:Label ID="lblBlock1" runat="server" Text="[" Visible="false" />&nbsp;<asp:LinkButton
                                                ID="lbReadMore" runat="server" Text="Lees meer" Visible="false" />&nbsp;<asp:Label
                                                    ID="lblBlock2" runat="server" Text="]" Visible="false" />
                                        </td>
                                    </tr>
                                </table>
                            </ItemTemplate>
                            <AlternatingItemTemplate>
                                <table width="100%">
                                    <tr style="font-size: 14px">
                                        <td style="width: 40%">
                                            <b>Door:</b>&nbsp;<asp:Label ID="lblReviewUser" runat="server" /><asp:HiddenField
                                                ID="hfUserId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "UserId") %>' />
                                        </td>
                                        <td>
                                            <b>Cijfer:</b>&nbsp;<asp:Label ID="lblReviewCipher" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Cipher") %>' />
                                        </td>
                                        <td align="right">
                                            <b>Datum:</b>&nbsp;<asp:Label ID="lblReviewDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Date") %>' />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3" style="padding-top: 10px">
                                            <asp:Label ID="lblReviewText" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Text") %>' />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <asp:Label ID="lblBlock1" runat="server" Text="[" Visible="false" />&nbsp;<asp:LinkButton
                                                ID="lbReadMore" runat="server" Text="Lees meer" Visible="false" OnClick="ReadMore" />&nbsp;<asp:Label
                                                    ID="lblBlock2" runat="server" Text="]" Visible="false" />
                                        </td>
                                    </tr>
                                </table>
                            </AlternatingItemTemplate>
                        </asp:Repeater>
                    </td>
                </tr>
            </asp:View>
        </asp:MultiView>
    </asp:Panel>
</table>

<script type="text/javascript">

    function textCounter(field, countfield, maxlimit) {
        if (countfield != null) {
            if (field.value.length > maxlimit)
                field.value = field.value.substring(0, maxlimit);
            else
                countfield.value = maxlimit - field.value.length;
        }
    }

</script>

